﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KhtApi.Model
{
    public class ProductInfo
    {
        /// <summary>
        /// Instance ID
        /// </summary>
        public string Id { get; set; }
        public string ItemCode { get; set; }
        public string Name { get; set; }
        public string ModelNo { get; set; }
        public string Spec { get; set; }
        public double? Cost { get; set; }
        public EOrigin Origin { get; set; }
        /// <summary>
        /// 自产|外购|客供|委外
        /// </summary>
        public string OriginCn
        {
            get
            {
                return Origin.ToString();
            }
            set
            {
                if (Enum.TryParse(value, out EOrigin origin))
                {
                    Origin = origin;
                }
                else
                {
                    throw (new Exception("不支持的产品来源类型！请确保输入的字符串为‘自产|外购|客供|委外’四种之一"));
                }
            }
        }
        public string Catagory1 { get; set; }
        public string Catagory2 { get; set; }
        public string Catagory3 { get; set; }
        public string Unit { get; set; }
    }
}
